package cn.geminis.lowcode.utils;

import cn.geminis.lowcode.compiler.code.LcClass;

import java.util.HashMap;
import java.util.Map;

public class SourceFileContext {

    private static final Map<String, LcClass> CLASSES = new HashMap<>();

    public static void registerClass(String name, LcClass clazz) {
        CLASSES.put(name, clazz);
    }

    public static LcClass findClass(String name) {
        return CLASSES.get(name);
    }

    public static void generateSourceFile() {
        CLASSES.forEach((name, clazz) -> clazz.generateSourceFile());
    }

    private SourceFileContext() {
    }
}
